package com.jp.synchronize;

public class SynchronizedStatic {
	
	
	
	static {
		synchronized (SynchronizedStatic.class) {
			try {
				System.out.println(Thread.currentThread().getName());
				Thread.sleep(5000);
			}catch(InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
	
	public synchronized static void  m1() {
		
		try {
			System.out.println(Thread.currentThread().getName()+ ",M1");
			Thread.sleep(5000);
		}catch(InterruptedException e) {
			e.printStackTrace();
		}
	}
	
	public synchronized static void  m2() {
		
		try {
			System.out.println(Thread.currentThread().getName()+ ",M2");
			Thread.sleep(5000);
		}catch(InterruptedException e) {
			e.printStackTrace();
		}
	}
	
	public  static void  m3() {
		try {
			System.out.println(Thread.currentThread().getName()+ ",M3");
			Thread.sleep(5000);
		}catch(InterruptedException e) {
			e.printStackTrace();
		}
	}

}
